<template>
	<view>
		<view class="feeddetail">
			<!-- <text class="title">{{feedDetail.title}}</text> -->
			<h2 class="title">{{feedDetail.title}}</h2>
			<view class="info">
			    {{feedDetail.feedbackTime}}
			</view>
			<view class="content">
				{{feedDetail.content}}
			</view>
			<button type="primary" @click="deleteFeed">删除</button>
		</view>
	</view>
</template>

<script>
	import {
		feedbackHistory,deleteFeedback
	} from '@/until1/api1.js'
	export default {
		data() {
			return {
				feedDetail: {},
				id:''
			}
		},
		onLoad(options) {
			this.id = options.id
			this.getFeedDetail(this.id)
		},
		methods: {
			async getFeedDetail(data) {
				let r = await feedbackHistory({id:data})
				console.log(r)
				this.feedDetail = r.data[0]
			},
			async deleteFeed() {
				let r = await deleteFeedback(this.id)
				console.log(r)
				// 判断是否删除成功 如果成功就提示删除成功，并返回到反馈历史页面
				if (r.code == 200) {
					uni.showToast({
						title: r.msg,
						icon: "success"
					})
					setTimeout(() => {
						uni.navigateTo({
							url:"/pages/mine/feedHistory/feedHistory"
						})
					}, 1500)
				}else{
					uni.showToast({
						title: r.msg,
						icon: "error"
					})
				}
			}
		}
	}
</script>

<style>
	.feeddetail {
		font-size: 30rpx;
		padding: 0 20rpx;
	}

	.title {
		text-align: center;
		width: 710rpx;
		display: block;
		margin: 50rpx 20rpx;
	}

	.info {
		margin-top: 50rpx;
		margin-left: 470rpx;
		font-size: 25rpx;
		color:slategrey;
	}

	.content {
		margin-top: 40rpx;
		margin-left: 10rpx;
		font-size: 25rpx;
		text-indent: 2em;
		/* border:1px solid lightgrey; */
		/* padding:20rpx; */
	}

	button {
		width: 600rpx;
		margin-top: 150rpx;
		border-radius: 20rpx;
		color: #fff;
	}
</style>
